package com.test.controller;

import com.test.dao.StudentDao;
import com.test.dao.UserDao;
import com.test.entity.Student;
import com.test.entity.User;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;
import java.util.UUID;

/**
 * Created by Cheng on 2017/8/13.
 */

@org.springframework.stereotype.Controller
public class Controller {

    @Autowired
    private StudentDao dao;

    @Autowired
    private UserDao userDao;

    @RequestMapping("/saveUser")
    @ResponseBody
    public String testGet(){

        System.out.println("star");
        String id = UUID.randomUUID().toString().replace("-","");
        User user = new User(id,"cheng",25);
//        User user1 = dao.findByName("cc");
        User u = userDao.findByName("cc");
        System.out.println(u);
        Student student = new Student(id,"bbbbb");
        dao.save(student);
        System.out.println("ok");
        return "ok";
    }

}
